#include<iostream>
#include<vector>
using namespace std;
const int N = 1e6 + 10;
int a[N], S[N];
int main()
{
	int n, k;
	cin >> n >> k;
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &a[i]);
		S[i] = S[i - 1] + a[i];
	}
	int maxx = 0;
	for (int i = k+1; i <= n; i++)
	{
		maxx=max(maxx,S[i] - S[i - k-1]);
	}
	cout << maxx;
}